<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="layout" content="main"/>
    <title>Live Chat</title>
</head>
<body>
<g:each in="${nonConfirmed}" var="chat">
    <div class="comment-outter">
        <g:hiddenField name="commentId" value="${chat.id}"/>
        ${chat.comment.encodeAsHTML()}
        <span class="remove">Remove</span>
        <span class="confirm">Confirm</span>
    </div>
</g:each>

<g:javascript>
    $(".remove").click(function(e) {

		var value = $(e.target).siblings("[name=commentId]").val();
		data = "id="+value+"&confirmed=false"

        $.ajax({
            type: "POST",
            url: "/recipeexchange/coverlive/allowed",
            data: data,
            success: function(msg) {
                $(e.target).parent().remove();
            }
        });

    });

    $(".confirm").click(function(e) {

		var value = $(e.target).siblings("[name=commentId]").val();
		data = "id="+value+"&confirmed=true"


        $.ajax({
            type: "POST",
            url: "/recipeexchange/coverlive/allowed",
            data: data,
            success: function(msg) {
                $(e.target).parent().remove();
            }
        });
    });
</g:javascript>


</body>
</html>